<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>预挂线-下线</title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/plugin/layui/css/layui.css" media="all" />
    <script type="text/javascript" src="/static/plugin/jquery/jquery-3.3.1.js"></script>
    <script type="text/javascript" src="/static/plugin/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/base.js"></script>
</head>

<body class="layui-anim layui-anim-up">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>预挂线-在线</cite>
        </a>
      </span>
</div>
<div class="x-body">
    <div class="layui-row" style="margin-bottom: 18px">
        <div class="layui-form">
            <div class="layui-input-inline">

                <div class="layui-input-inline" style="width: 150px">
                    <input class="layui-input" id="keyword01" placeholder="请输入工位编号" style="width: 150px">
                </div>
                <button class="layui-btn layui-btn-normal" data-type="reload"><i class="layui-icon layui-icon-search"></i>检索</button>
            </div>
        </div>
    </div>
    <xblock>
        <!--<button class="layui-btn layui-btn-warm" id="add"><i class="layui-icon layui-icon-add-circle-fine"></i>新增</button>-->
        <!--<button class="layui-btn layui-btn-danger" id="dybd"><i class="layui-icon layui-icon-print"></i>单据打印</button>-->
    </xblock>
    <div id="subDiv2">
        <table class="layui-hide" id="tableList" lay-filter="tableList"></table>
    </div>
    <div id="subDiv1" hidden="hidden">
        <table class="layui-hide" id="tableList1" lay-filter="tableList1"></table>
    </div>
</div>
<div class="x-body" id="subDiv" hidden="hidden">

    <table class="layui-hide" id="tableDetails" lay-filter="tableDetails"></table>
</div>
<script type="text/html" id="rowToolbar">
    <a class="layui-btn layui-btn-xs" lay-event="serchCar"><i class="layui-icon layui-icon-search"></i>查看装车信息</a>
</script>

<script type="text/html" id="rowToolbar2">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete1"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>

<script type="text/html" id="productAddRowToolbar">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="proDel">删除</a>
</script>

<!-- 导入框 -->
<div id="importDiv" hidden="hidden">
    <form class="layui-form" id="uploadform">
        <div style="margin: 20px 0 20px 140px;">
            <input id="fileInput" name="file" type="file" accept=".xls,.xlsx"/>
        </div>
    </form>
    <button class="layui-btn layui-btn-blue" lay-filter="uplodeform" style="margin-left: 80px">导入数据</button>&emsp;&emsp;&emsp;&emsp;
    <button type="button" class="layui-btn" id="downloadFile">下载模板</button>
</div>

<!-- 装车信息框 -->
<div id="carDiv" hidden="hidden">
    <form class="layui-form">
        <div class="layui-form-item" >
        </div>
        <div class="layui-form-item" >
            <div class="layui-inline">
                <label class="layui-form-label">车辆牌号</label>
                <div class="layui-input-inline">
                    <input type="tel" name="phone"  autocomplete="off" value="陕A9999" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">当班司机</label>
                <div class="layui-input-inline">
                    <input type="text" name="email"  autocomplete="off"  value="李四" readonly class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">时间</label>
                <div class="layui-input-inline">
                    <input type="tel" name="phone"  autocomplete="off" value="2020-02-04 16:30:10" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-inline">
                    <input type="text" name="email"  autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </form>
</div>


<!-- 产品选择框 -->
<div id="productDiv" hidden="hidden">
    <form class="layui-form">
        <div style="margin-bottom: 18px">
            <div class="layui-inline">
                <table style="margin-top: 10px">
                    <tr>
                        <td>
                            <input class="layui-input" name="materiel_num_search" id="materiel_num_search" placeholder="请输入图号" autocomplete="off" style="display: inline; width: 180px; margin-left: 10px">
                        </td>
                    </tr>
                </table>
            </div>
            &emsp;<button style="margin-top: 10px" class="layui-btn layui-btn-normal" type="button" id="selectMateriel" data-type="reload"><i class="layui-icon layui-icon-search"></i>检索</button>
        </div>
        <table id="productTable" lay-filter="productTable"></table>
        <input id="dtim" type="hidden">
        <xblock>
            <button class="layui-btn layui-btn-blue" lay-submit lay-filter="productform" style="margin: 0px 0px 10px 200px; width: 500px">提交</button>
        </xblock>
    </form>
</div>

<!-- 二次产品选择框 -->
<div id="productDiv2" hidden="hidden">
    <form class="layui-form" id="addFormID2">
        <div style="margin-bottom: 18px">
            <div class="layui-inline">
                <table style="margin-top: 10px">
                    <tr>
                        <td>
                            <input class="layui-input" name="materiel_num_search2" id="materiel_num_search2" placeholder="请输入图号" autocomplete="off" style="display: inline; width: 180px; margin-left: 10px">
                        </td>
                    </tr>
                </table>
            </div>
            &emsp;<button style="margin-top: 10px" class="layui-btn layui-btn-normal" type="button" id="selectMateriel2" data-type="reload2"><i class="layui-icon layui-icon-search"></i>检索</button>
        </div>
        <table id="productTable2" lay-filter="productTable2"></table>
        <xblock>
            <button class="layui-btn layui-btn-blue" lay-submit lay-filter="productform2" type="button" style="margin: 0px 0px 10px 500px; width: 400px;margin-left: 250px;">提交</button>
        </xblock>
    </form>
</div>

<!-- 新增框 -->
<div id="addDivID" hidden="hidden">
    <form class="layui-form" id="addFormID">
        <xblock>
            <table>
                <tr>
                    <td><label class="layui-form-label">入库单号</label></td>
                    <td>
                        <input readonly class="layui-input" id="receiveNumber" name="receiveNumber" style="width: 160px; color: gray" placeholder="请输入收货单号">
                        <input type="hidden" id="id" name="id">
                    </td>
                    <td>
                        <label class="layui-form-label">入库人员</label>
                    </td>
                    <td>
                        <input readonly class="layui-input" id="sendName" name="sendName" style="width: 160px; color: gray">
                    </td>
                    <td>
                        <label class="layui-form-label">时间</label>
                    </td>
                    <td>
                        <input class="layui-input" id="sendDate" name="sendDate" style="width: 160px" placeholder="请选择收货日期">
                    </td>

                    <td>
                        <label class="layui-form-label"></label>
                    </td>

                    <td>
                        <button type="button" class="layui-btn layui-btn-normal" onclick="addProduct()">选择物料</button>
                    </td>
                <tr style="height:10px"></tr>
            </table>
        </xblock>
        <table id="productAddTable" lay-filter="productAddTable"></table>
        <xblock>
            <div align="center">
                <button class="layui-btn layui-btn-blue" id="subBtn" lay-submit lay-filter="addForm">提交</button>
                &emsp;&emsp;&emsp;&emsp;
                <button class="layui-btn layui-btn-primary">取消</button>
            </div>
        </xblock>
    </form>
</div>

<!-- 打印表单框 -->
<div id="dybdDivID" hidden="hidden">
    <div id="dyDiv" style="width: 100%;overflow-y:scroll;height: 549px">
        <table style="width: 100%;">
            <tr>
                <td align="center" colspan="2">
                    <h1>华强公司入库单</h1>
                </td>
            </tr>
            <tr style="height:10px"></tr>
            <tr>
                <td colspan="2" width="100%" align="center">
                    <table width="70%">
                        <tr>
                            <td width="40%">
                                入库单号：<span id="sendNumbers"></span>
                            </td>
                            <td width="30%">
                                时间：
                            </td>
                            <td>
                                入库人员：<span id="sendPeoples"></span>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr style="height:5px"></tr>
            <tr>
                <td colspan="2"  width="100%" align="center">
                    <table id="dytable" lay-filter="dytable">
                    </table>
                </td>
            </tr>
            <tr style="height:5px"></tr>
        </table>
    </div>
    <xblock>
        <div align="right" style="margin-bottom: 0px;">
            <button type="button" id="dayingTable" class="layui-btn" style="margin-left: 450px;background-color: #57575799;"><i class="layui-icon">&#xe66e;</i>打印</button>
        </div>
    </xblock>
</div>
<!-- 打印标签条码框 -->
<div id="dybqDivID" hidden="hidden">
    <div style="width: 100%;overflow-y:scroll;height: 499px">
        <table id="bqtable" lay-filter="bqtable">
        </table>
    </div>
    <xblock>
        <div align="right" style="margin-bottom: 0px;">
            <button type="button" id="dytm" class="layui-btn" style="margin-left: 450px;background-color: #57575799;"><i class="layui-icon">&#xe66e;</i>打印</button>
        </div>
    </xblock>
</div>
<!-- 打印标签框 -->
<div id="dytmDivID" hidden="hidden">
    <div id="tmdyDiv" style="width: 100%;overflow-y:scroll;height: 499px"></div>
    <xblock>
        <div align="right" style="margin-bottom: 0px;">
            <button type="button" id="dayingTmdyTable" class="layui-btn" style="margin-left: 450px;background-color: #57575799;"><i class="layui-icon">&#xe66e;</i>打印</button>
        </div>
    </xblock>
</div>
<script type="text/javascript">
    function createTime(v){
        var date = new Date(v);
        var y = date.getFullYear();
        var m = date.getMonth()+1;
        m = m<10?'0'+m:m;
        var d = date.getDate();
        d = d<10?("0"+d):d;
        var h = date.getHours();
        h = h<10?("0"+h):h;
        var M = date.getMinutes();
        M = M<10?("0"+M):M;
        var str = y+"-"+m+"-"+d+" "+h+":"+M;
        return str;
    }

    var table;
    var customerId2;
    var receiveNumber2;
    layui.use(['table','layer','upload','form','laydate'], function(){
        table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;

        var $ = layui.jquery, active = {
            reload:function () {
                var keyword01 = $.trim($("#keyword01").val());
                table.reload('contenttable',{
                    method:'get',
                    where:{
                        stationNumber:keyword01
                    }
                    ,page: {
                        //重新从第 1 页开始
                        curr: 1
                    }
                });
            }
        };

        $(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
            e.stopPropagation();
        });
        $('.layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        form.render();
        table.render({
            elem:'#tableList'
            ,url:'/preOnLine/queryPreHangingLinePage'
            ,title:'machineList'
            ,where:{
                'status':'2'
            }
            ,id :'contenttable'
            ,limits:[10,20,30]
            ,cols: [
                [ //表头
                    {field:'uid', title:'序号', width: 60,type:'numbers', align:'center'}
                    ,{field: 'stationNumber', title: '工位编号'}
                    ,{field:'maNumber', title:'产品图号', align:'center'}
                    ,{field:'maName', title:'产品名称', align:'center'}
                    ,{field:'quantity', title:'数量', width: 120, edit: 'text', align:'center'}
                    // ,{field:'maSprayingRequirements', title:'喷涂要求', edit: 'text', align:'center'}
                    ,{field: 'source', title: '来源',templet:function (row) {
                        if (row.source === 'FJ') {
                            return '分拣区';
                        }else if (row.source === 'QCL') {
                            return '前处理区';
                        }

                    }}
                    ,{field: 'realName2', title: '操作人'}
                    ,{field: 'updateDate',title: '时间',align:'center',templet:function (row) {
                        return createTime(row.updateDate);
                    }
                }
                ]
            ]
            ,page: true
            ,done: function(res, curr, count){
                $('th').css({
                    'background-color': '#009688', 'color': '#fff','font-weight':'bold'
                });
            }
        });

        /*table.on('row(tableList)', function(obj){
            var data = obj.data;
            var stationId = data.stationId;
            $("#subDiv").show();
            table.render({
                elem: '#tableDetails'
                ,url:'/preOnLine/queryPreHangingLineDetailPage'
                ,title: '明细表'
                ,where: {
                    'stationId':stationId
                }
                ,id :'contenttableDetails'
                ,limits:[10,20,30]
                ,cols: [
                    [
                        {field:'id', title:'序号', width: 50,type:'numbers', align:'center'},
                        {field:'materielId', title:'物料id', align:'center', hide:true},
                        {field:'maNumber', title:'图号', align:'center'},
                        {field:'maName', title:'名称', align:'center'},
                        {field:'quantity', title:'数量', width: 120, edit: 'text', align:'center'},
                        {field:'maSprayingRequirements', title:'喷涂要求', edit: 'text', align:'center'}
                    ]
                ]
                ,page: true
                ,done : function(){
                    $('th').css({
                        'background-color': '#009688', 'color': '#fff','font-weight':'bold'
                    })
                }
            });
        });*/
    });
</script>
</body>
</html>
